package ovm.gui.views.administration.factory;

import ovm.gui.views.AbstractCatalogView;
import ovm.management.AbstractManager;

/**
 * Created by IntelliJ IDEA.
 * User: Jokser
 * Date: 08.06.12
 * Time: 9:01
 * To change this template use File | Settings | File Templates.
 */
public class EntityCollectionPropertiesView extends AbstractCatalogView {
    public EntityCollectionPropertiesView(Class entityClass, Boolean editable) {
        super(entityClass, editable);
        setCaption("Настройка для связей One To Many");
    }

    @Override
    protected int addNewEntity() {
        return AbstractManager.addDefaultEntity(entityClass);
    }
    
    @Override
    protected void setContainerProperties() {
        entityContainer.addContainerProperty("entityClass", String.class, "", true, true);
        entityContainer.addContainerProperty("referenceClass", String.class, "", true, true);
        entityContainer.addContainerProperty("referenceParameter", String.class, "", true, true);
    }

    @Override
    protected void buildTable() {
        table.setVisibleColumns(new Object[] {"entityClass", "referenceClass", "referenceParameter"});
    }
}
